package com.ctgu.tengyun.service.product.impl;

import com.ctgu.tengyun.dao.mybatis.ProductGuideLogMapper;
import com.ctgu.tengyun.domain.ProductGuideLog;
import com.ctgu.tengyun.domain.ProductGuideLogExample;
import com.ctgu.tengyun.service.product.ProductGuideLogService;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

/**
 * Created by liaoweizhi on 2019/7/23.
 */
@Service
public class ProductGuideLogServiceImpl implements ProductGuideLogService {

    @Resource
    private ProductGuideLogMapper mapper;


    @Override
    public void insertSelective(ProductGuideLog productGuideLog) {
        mapper.insertSelective(productGuideLog);
    }

    @Override
    public List<ProductGuideLog> selectByGid(Collection<Integer> gid) {
        ProductGuideLogExample example = new ProductGuideLogExample();
        ProductGuideLogExample.Criteria criteria = example.createCriteria();

        criteria.andGidIn(Lists.newArrayList(gid));
        example.setLimit(3);
        example.setOrderByClause("id desc");
        return mapper.selectByExample(example);
    }
}
